package jmx;

import javax.management.AttributeChangeNotification;
import javax.management.Notification;
import javax.management.NotificationListener;

import sample.Util;

public class ClientListener implements NotificationListener {
	public void handleNotification(Notification notification, Object handback) {
		Util.echo("\n##########################");
		Util.echo("\nReceived notification:");
		Util.echo("\tClassName: " + notification.getClass().getName());
		Util.echo("\tSource: " + notification.getSource());
		Util.echo("\tType: " + notification.getType());
		Util.echo("\tMessage: " + notification.getMessage());
		if (notification instanceof AttributeChangeNotification) {
			AttributeChangeNotification acn = (AttributeChangeNotification) notification;
			Util.echo("\tAttributeName: " + acn.getAttributeName());
			Util.echo("\tAttributeType: " + acn.getAttributeType());
			Util.echo("\tNewValue: " + acn.getNewValue());
			Util.echo("\tOldValue: " + acn.getOldValue());
		}
	}
}